<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%
 String path = request.getContextPath();
 String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<base href="<%=basePath%>">
	<title>${question.title } - SegmentFault</title>
	<jsp:include page="../common/_meta.jsp"></jsp:include>
</head>
<body>
	<jsp:include page="../common/_header.jsp"></jsp:include>
	<div class="wrap">
		<div class="inner edge">
		    <h1 class="q-title" >
		        <span>${question.title }</span>
		            </h1>
		    <div id="main">
		        <div id="question">
		            <article class="q-post" id="${question.id }" >
		                <div class="fmt post-content">
		                	${question.content }            
						 </div><!-- end .post-content -->
		                <div class="post-foot">
		                    <table class="post-parter">
		                        <tbody>
		                        	<tr>
		                                <td>
		                                	<a href="u/${question.user_id }" tabindex="-1"><img class="avatar-32" src="${user.head_photo }" alt=""></a>
		                            	</td>
		                            <td class="post-author">
		                                <h4><a href="u/${question.user_id }">${user.login_name }</a><strong title="活跃度" class="level-9">${user.liveness }</strong></h4>${timeGo }<br>
		                            </td>
		                        </tr>
		                    </tbody>
	                    	</table>
		                </div><!-- end .post-foot -->
		            </article>
		        </div><!-- end #question -->
				<div id="answer">
				    <h2 class="a-title">${fn:length(answersList)}个回答</h2>
				   	<c:forEach var="answer" items="${answersList }">
				   		<article class="a-post accepted" id="${answer.id }" data-votes="${answer.jack_num }">
				   			<div class="post-cell">
								<a href="vote" class="post-big-vote">
									<span>${answer.jack_num }</span>顶
								</a>
								<a href="hate" class="post-big-hate tip-pop" data-tip="w:该投票为匿名" original-title="">踩</a>
								<c:if test="${answer.best_answer == 1}">
									<div class="accept-mark" title="采纳答案">采纳</div>
								</c:if>
							</div>
							<div class="fmt post-content">
								${answer.answer_content}
							</div><!-- end .post-content -->
						</article>	
				   	</c:forEach>
				</div> 	
		        <div id="write-answer">
		            <h2 class="small-title">撰写答案</h2>
		            <form method="post" action="question/answer">
		                <div class="editor">
		                	<a href="#" title="粗体文本 (快捷键 Ctrl+B)" class="btnBold"></a>
		                	<a href="#" title="斜体文本 (快捷键 Ctrl+I)" class="btnItalic"></a>
		                	<a href="#" title="代码文本 (快捷键 Ctrl+D)" class="btnCode"></a><i></i>
		                	<a href="#" title="引用段落 (快捷键 Ctrl+Q)" class="btnQuote"></a>
		                	<a href="#" title="代码 (快捷键 Ctrl+K)" class="btnPre"></a>
		                	<a href="#" title="标签链接 (快捷键 Ctrl+T)" class="btnTag"></a><i></i>
		                	<a href="#" title="副标题 (快捷键 Ctrl+H)" class="btnHeading"></a>
		                	<a href="#" title="分割线 (快捷键 Ctrl+R)" class="btnHr"></a>
		                	<a href="#" title="普通列表 (快捷键 Ctrl+U)" class="btnUl"></a>
		                	<a href="#" title="数字列表 (快捷键 Ctrl+O)" class="btnOl"></a><i></i>
		                	<a href="#" title="链接 (快捷键 Ctrl+L)" class="btnLink"></a>
		                	<a href="#" title="图片 (快捷键 Ctrl+G)" class="btnImg"></a>
		                	<a href="#" title="打开高级编辑器" class="btnAdvance right"></a>
		                </div>
		                <p>
		               		<textarea id="ans-text" class="textarea-14" rows="10" autocomplete="off" spellcheck="false" data-advanced="0" name="text"></textarea>
		                </p>
		                <c:if test="${user == null}">
						<div class="form-action">
		                    <input type="submit" class="btn btn-big" value="提交答案">
		                    <input type="hidden" value="${question.id }" name="question.id">
		                </div>
		            	<div class="login-warn">请先 <a href="user/login">登录</a> 后撰写答案</div>
		            	</c:if>
		                <div class="fmt preview">
							<p></p>
						</div>
		            </form>
		        </div><!-- end #write-answer -->
		    </div><!-- end #main -->
		
		    <div id="secondary">
		        <aside class="q-info">
		        	<h3>标签</h3>
		            <form class="tag-edit-form">
		            <ul class="tag-list show-pop-tag edit-disabled">
		            	<c:forEach var="tag" items="${tagsList }">
		            		<li>
		            			<a data-tid="${tag.id }" href="t/${tag.id }" class="tag">${tag.tag_name }</a>
		            		</li>
		            	</c:forEach>
                    </ul>
		            </form>
		        </aside>
				<aside class="box">
					<h3>相关问题</h3>
					<ul class="link-list">
						<c:forEach var="sortQuest" items="${sortQList }">
							<li><a href="q/${sortQuest.id }">${sortQuest.title }</a></li>
						</c:forEach>
					</ul>
		        </aside>
	            </div><!-- end #secondary -->
			</div>
		</div><!-- end .wrap -->
	<jsp:include page="../common/_footer.jsp"></jsp:include>
</body>
</html>